<extend name='Public/_Main' />
<block name='title'>
    <title>联动模型数据管理</title>
</block>

<block name='right'>
    <form class="am-form">
    
        <table class="table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>名称</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name='list' id='lis'>
                    <tr>
                        <td class='id'>{$lis.id}</td>
                        <td>
                            <span class='pull-left'>└&nbsp;&nbsp;</span>
                            <a href="#" class='pull-left'>
                                <input type='text' value='{$lis.name}' class='form-control' name='name'>
                            </a>
                        </td>
                        <td>
                            <div role="group" class="btn-group">
                                <a href="{:U('dellink',array('id'=>$_GET['id'],'pid'=>$lis['id']))}" class="btn btn-danger getajax">删除</a></div>
                        </td>
                    </tr>
                    <volist name='lis._child' id='chi'>
                        <tr>
                            <td class='id'>{$chi.id}</td>
                            <td>
                                <span class='pull-left'>└────&nbsp;&nbsp;</span>
                                <a href="#" class='pull-left'>
                                    <input type='text' value='{$chi.name}' class='form-control' name='name'>
                                </a>
                            </td>
                            <td>
                                <div role="group" class="btn-group">
                                    <a href="{:U('dellink',array('id'=>$chi['id']))}" class="btn btn-danger getajax">删除</a></div>
                            </td>
                        </tr>
                        <volist name='chi._child' id='fres'>
                            <tr>
                                <td class='id'>{$fres.id}</td>
                                <td>
                                    <span class='pull-left'>└───────────&nbsp;&nbsp;</span>
                                    <a href="#" class='pull-left'>
                                        <input type='text' value='{$fres.name}' class='form-control' name='name'>
                                    </a>
                                </td>
                                <td>
                                    <div role="group" class="btn-group">
                                        <a href="{:U('dellink',array('id'=>$fres['id']))}" class="btn btn-danger getajax">删除</a></div>
                                </td>
                            </tr>
                        </volist>
                    </volist>
                </volist>
            </tbody>

        </table>
        <div class="alert alert-danger" role="alert">提醒：联系动模型数据最多只显示三级</div>
    </form>
    <fieldset id="city_select" class='linkmodel' href="{:U('link',array('id'=>$_GET['id']))}">
    <legend>以下是效果演示</legend>
    <p>{$title.name}：
      <select class="province" data-first-title="请选择" name='{$title.field}[]'>
        <option selected></option>
      </select>
      <select class="city" data-first-title="请选择" name='{$title.field}[]'>
        <option selected></option>
      </select>
      <select class="area" data-first-title="请选择" name='{$title.field}[]'>
        <option selected></option>
      </select>
    </p>
  </fieldset>
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">新增字段</h4>
                </div>
                <div class="modal-body">
                    <form class="require" action="{:U('addlink')}" method="post">
                        <div class="form-group">
                            <label for="exampleInputEmail1">名称<span class="Validform_checktip"></span></label>
                            <input type="text" class="form-control" placeholder="例：姓名" datatype='*' name='name'>
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">选择所属节点<span class="Validform_checktip"></span></label>
                            <select name="pid" class='form-control selectpicker' datatype='*' data-live-search="true">
                                <option value="0">
                                    ----根节点----
                                </option>
                                <volist name='list' id='a'>
                                    <option value="{$a.id}">└{$a.name}</option>
                                    <volist name='a._child' id='child'>
                                        <option value="{$child.id}">└────{$child.name}</option>
                                        <volist name='child._child' id='fre'>
                                            <option value="{$fre.id}">└───────────{$fre.name}</option>
                                        </volist>
                                    </volist>
                                </volist>
                            </select>
                        </div>
                        <input type='hidden' name='linkid' value='{$Think.get.id}' />
                        <div class="modal-footer">
                            <div class='col-xs-6'>
                                <button class="btn btn-lg btn-primary btn-block" type="submit">保存</button>
                            </div>
                            <div class='col-xs-6'>
                                <button class="btn btn-lg btn-default btn-block" type="button" data-dismiss="modal">关闭</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!--end Modal-->
</block>
<block name='javascript'>
    <script type="text/javascript">
    var romClassification = "{:U('romlink')}";
    </script>
</block>
